<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta property="qc:admins" content="6525276424516367" />
    <meta property="wb:webmaster" content="ce8327d47982a584" />

    <title>慕图素材</title>

    <link rel="stylesheet" href="/static/lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="/static/schema/default/css/base.css">
    <link href="/static/schema/default/css/dashboard.css" rel="stylesheet">
    <script src="/static/lib/jquery/jquery-2.1.3.min.js"></script>
    <script src="/static/lib/bootstrap/js/bootstrap.js"></script>
</head>
<body>
    <nav class="navbar navbar-inverse navbar-fixed-top">
        <div class="container-fluid">
            <div id="navbar" class="navbar-collapse collapse row">
                <div class="col-sm-offset-1">
                    <ul class="nav navbar-nav">
                        <li >
                            <a href="/">首页</a>
                        </li>
                        <li >
                            <a href="/auth/index">登录</a>
                        </li>
                        <li >
                            <a href="/auth/logout">退出</a>
                        </li>
                        <li >
                            <a href="/resource/upload/index">上传资源</a>
                        </li>
                         <li >
                            <a href="/resource/matter/create/index">创建素材</a>
                        </li>
                        <li >
                            <a href="/resource/matter/manage/index">素材管理</a>
                        </li>
                     
                        <li >
                            <a href="/resource/binder/manage/index">收藏夹管理</a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </nav>
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-6 col-sm-offset-2 alertDiv" id="notice_messages"></div>
        </div>
    </div>
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-10 col-sm-offset-1 main">
        
                <table class="table table-striped table-hover text-left" for="pics">
                    <tbody id="fsUploadProgress">
                        {{ range .matters }}
                        <tr id="{{ .Uuid }}" class="progressContainer" style="opacity: 1;" >
                            <td >
                                <div>
                                    <b>{{ .Title }}</b>
                                </div>
                                <div>
                                    标签：
                                    <span class="origin-height">
                                        {{ range .Tags}}
                                         {{ .Name }}
                                        {{ end}}
                                    </span>
                                </div>
                                <div>
                                    <pre>{{ .Desc }}</pre>
                                </div>

                                
                            </td>
                            <td >
                                <div class="Wrapper">
                                    <div class="imgWrapper col-md-4">
                                        <a class="linkWrapper" target="_blank" href="{{ .Link }}" title="查看原图">
                                            <img src="{{ .Link }}?imageView2/1/w/100/h/100"></a>
                                    </div>
                                </div>
                            </td>

                            <td >
                                <div>
                                    宽度：
                                    <span class="orgin-width">{{ .Width }}px</span>
                                </div>
                                <div>
                                    高度：
                                    <span class="origin-height">{{ .Height }}px</span>
                                </div>
                                <div>
                                    大小：
                                    <span class="origin-height">{{ .Size }}</span>
                                </div>
                                <div>
                                    上传时间：
                                    <span class="origin-height">{{ .CreateAt }}</span>
                                </div>
                            </td>
                            <td>
                                <button class="btn" onclick="removeItem('{{ .Uuid }}')">取消收藏</button>
                                
                            </td>
                        </tr>
                        {{ end }}
                    </tbody>
                </table>

            </div>
        </div>
    </div>

    <!-- Modal -->
    <div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">

                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
                    <h5 id="myModalLabel">收藏</h5>
                </div>
                <div class="modal-body">
                    <input type="hidden" id="hideFlag" value=""/>
                    <input type="hidden" id="hideMatter" value=""/>
                    <div class="form-group">
                        <label class="control-label col-sm-1" for="cats">分类：</label>
                        <div class="controls col-sm-7">
                           <select class="form-control" id="binderSelect">
                                <option value="">---请选择---</option>
                                    {{ range .binders }}
                                        <option value="{{ .Uuid }}">{{ .Title }}</option>
                                    {{ end }}
                             </select>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-primary" onclick="binde()" type="button">
                        确定
                    </button>
                    <button class="btn" type="button" data-dismiss="modal" aria-hidden="true">
                        取消
                    </button>
                </div>     
            </div>
        </div>
    </div>

<script type="text/javascript">


    function removeItem(uuid){
         if(!confirm("确认取消收藏该素材？")){
            return false;
        }
        var url = "/resource/binder/item/remove?matterid=" + uuid;

        $.get(url, function (body) {
            res = body;
            if (res.ok) {
                alert("取消收藏成功");
                location.reload() 
            }else {
                alert(res.msg);
            }
        }).fail(function() {
            alert("ajax 网络错误");
        });

        //
        //$("#hideFlag").val(flag);
        //$("#hideMatter").val(uuid);
        //$("#modal").modal("show");
    }


</script>


</body>
    </html>
